package com.jiayang.webviewprocess.webchromeclient;

import android.util.Log;
import android.webkit.WebChromeClient;
import android.webkit.WebView;

import com.jiayang.webviewprocess.webviewclient.WebViewCallBack;

/**
 * @ClassName MyWebChromeClient
 * @Author JIAYANG
 * @Date 2022/4/26 15:56
 * @Email 1354856871@qq.com
 */
public class MyWebChromeClient extends WebChromeClient {
    public static final String TAG = "MyWebChromeClient";
    private WebViewCallBack mWebViewCallBack;

    public MyWebChromeClient(WebViewCallBack webViewCallBack){
        this.mWebViewCallBack = webViewCallBack;
    }

    @Override
    public void onReceivedTitle(WebView view, String title) {
        super.onReceivedTitle(view, title);
        if (mWebViewCallBack!=null){
            mWebViewCallBack.updateTitle(title);
        }else {
            Log.e(TAG,"WebViewCallBack is null.");
        }
    }
}
